package javaIO;

import java.util.prefs.Preferences;

/**
 * @Author: Simune
 * @Description:
 * @Date: Create on 9:36 PM 4/26/18
 * @Modified By:
 */
public class PreferencesDemo {
    public static void main(String[] args) throws Exception {
        Preferences perfs = Preferences.userNodeForPackage(Preferences.class);
        perfs.put("Location","Oz");
        perfs.put("Footwear","Ruby Slippers");
        perfs.putInt("Companions",4);
        perfs.putBoolean("Are there witches?",true);
        int usageCount = perfs.getInt("UsageCount",0);
        usageCount ++;
        perfs.putInt("usageCount",usageCount);
        for(String key : perfs.keys()){
            System.out.println(key+": "+perfs.get(key,null));
        }
        System.out.println("How Many comainions does Dorothy hava?"+perfs.getInt("Compainions",0));
    }
}
